home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
internet
/
miami_dodatki
/
togmi
/
rexx
/
togmi.rexx
Wrap
OS/2 REXX Batch file
|
1996-08-16
|
4KB
|
152 lines
/* TogMi 1.1 by Mat Bettinson
This script Toggles Miami's status. If not running, it may run it if desired.
If it's hung up, it will make Miami dial-up. If it's dialed-up, it'll hang-up etc.
The little window is configurable and goes away after a couple of seconds.
It beats opening up Miami's largish interferace every time.
Values below respesent defaults if Tooltypes can't be read. They usually can't be
read if the icon has been renamed or rexxtricks.library not found.
*/
MiamiDir = 'Store:Miami'
RunMiami = YES
KilMiami = NO
TopX = 300 /* Condensed to WINDOW in the Tooltypes */
TopY = 20
WidthX = 400
WidthY = 50
Iconify = YES
TogMiName = 'TogMi'
SetMiami = 'Miami.default'
/* Starts
*/
Options RESULTS
If ~Show(l,'rexxtricks.library') then DO
If AddLib('rexxtricks.library',0,-30) then rtricks = YES
ELSE rtricks = NO
END
ELSE rtricks = YES
Parse ARG TMName
TMName = strip(TMName)
ProgVer = 'TogMi for Miami 1.0'
OldDir = Pragma('Dir')
If rtricks = YES then Call ReadToolTypes
If Index(':/',right(MiamiDir,1)) = 0 then MiamiDir = MiamiDir'/'
Call Open(fout,'CON:'TopX'/'TopY'/'WidthX'/'WidthY'/'ProgVer'/AUTO/CLOSE','W')
Call Prt('*** 'ProgVer' - by Mat Bettinson ***')
If rtricks = 'NO' then Call Prt('Note: No rexxtricks.library in libs:, tooltypes ignored.')
If nfname = YES & nftmname = YES then Call Prt('Note: DOS script name 'TMName' and 'TogmiName' not found. Tooltypes ignored.')
If nfname = YES & nftmname ~= YES then Call Prt('Note: DOS script name 'TMName' not found, using 'TogmiName' default.')
MiRun = Show('P','MIAMI.1')
If ~MiRun & RunMiami ~= YES then DO
Call Prt('Miami is not running, TogMi set not to activate Miami.'
Signal Leave
END
If ~MiRun then DO
Call Prt('')
Call Prt('Miami not running, TogMi set to activate Miami.')
If ~EXISTS(MiamiDir'Miami') then DO
Call Prt('Miami not found in configed path 'MiamiDir', please edit script!')
Signal Leave
END
If ~EXISTS(MiamiDir||SetMiami) then DO
Call Prt('Note: Miami settings 'SetMiami' not found!')
SetMiami = 'Miami.default'
END
Call Prt('Running Miami with settings 'SetMiami'...')
Call Pragma('Dir',MiamiDir)
Address COMMAND 'RUN >NIL: 'MiamiDir'Miami SETTINGS='SetMiami
Call Pragma('Dir',OldDir)
wt = 0
DO while wt < 5
If Show('P','MIAMI.1') then break
Address COMMAND 'Wait 1'
wt = wt + 1
END
If wt = 5 then DO
Call Prt('Ouch!, I failed to detect Miami!')
Signal Leave
END
END
Address 'MIAMI.1'
'ISONLINE'
Online = RC
If Online then DO
Call Prt('Miami detected on-line.')
If KilMiami = NO then DO
Call Prt('Instructing Miami to hang-up...')
'OFFLINE'
Signal Leave
END
ELSE DO
Call Prt('Instructing Miami to hang-up and Quit...')
'QUIT'
Signal Leave
END
END
ELSE DO
Call Prt('Miami detected off-line.')
Call Prt('Instructing Miami to dial-up...')
If Iconify = YES then 'SHOW'
'ONLINE'
If Iconify = YES then 'HIDE'
If RC ~= 0 then Call Prt('There was an error dialing up!')
END
Leave:
Call Prt('Exiting...')
Address COMMAND 'Wait 3'
Call Close(fout)
EXIT
Prt:
Parse ARG line
Call WriteLN(fout,line)
RETURN
ReadToolTypes:
If ~EXISTS(OldDir'/'TMName) then DO
nfname = YES
If ~EXISTS(OldDir'/'TogMiName) then DO
nftmname = YES
RETURN
END
ELSE tmicon = OldDir'/'TogMiName
END
ELSE tmicon = OldDir'/'TMName
Call GETTOOLTYPES(tmicon,tooltypes)
Do i = 1 for tooltypes.0
Parse VAR tooltypes.i key rest
key = upper(key)
rest = strip(word(rest,1))
SELECT
When key = 'WINDOW' then DO
temp = translate(rest,' ',',')
If words(temp) ~= 4 then break
TopX = Word(temp,1) ; TopY = word(temp,2) ; WidthX = word(temp,3) ; WidthY = strip(word(temp,4))
END
When key = 'MIAMIDIR' then MiamiDir = rest
When key = 'RUNMIAMI' then RunMiami = rest
When key = 'KILMIAMI' then KilMiami = rest
When key = 'ICONIFY' then IconOpen = rest
When key = 'SETMIAMI' then SetMiami = rest
END
END
RETURN